/*********************************************
* ５、编写一个非递归算法，利用栈计算如下函数的值：
* f(0)=1,f(n) = n*f( floor(n/2) ),n>0
**********************************************/
#include<stdio.h>
#include<malloc.h>

typedef struct {int* data;int capacity,top; } stack;

stack* stack_new(int capacity){
    stack* s = malloc(sizeof(stack));
    s->capacity = capacity;
    s->top = 0;
    s->data = malloc(sizeof(int)*capacity);
    return s;
}

void stack_del(stack* s){free(s->data);free(s);}

int stack_pop(stack* s){
    if(s->top==0){perror("Empty stack");return 0;}
    return s->data[--s->top];
}

void stack_push(stack* s,int data){if(s->top < s->capacity)s->data[s->top++] = data;}

int main(){
    int n,k;
    scanf("%d",&n);
    if(n==1){printf("f(1)=1\n");return 0;}
    stack* s = stack_new(32); // max_int < 2^32
    k = n;
    while(1){
        stack_push(s,k);
        k /= 2;
        if(k==1)break;
    }
    k = 1;
    while(s->top)k *= stack_pop(s);
    printf("f(%d)=%d\n",n,k);
    stack_del(s);
    return 0;
}

